<?php
/**
 * 编辑器
 * @author qishunweb
 *
 */
class Ueditor{
	public function ueditor(){
		return '	<link rel="stylesheet" href="kindeditor-4.1.7/themes/default/default.css" />
	<link rel="stylesheet" href="kindeditor-4.1.7/plugins/code/prettify.css" />
	<script charset="utf-8" src="kindeditor-4.1.7/kindeditor.js"></script>
	<script charset="utf-8" src="kindeditor-4.1.7/lang/zh_CN.js"></script>
	<script charset="utf-8" src="kindeditor-4.1.7/plugins/code/prettify.js"></script>
				';
	}
	public function  ueditors($name,$content=""){
		return "<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name=\"$name\"]', {
				cssPath : 'kindeditor-4.1.7/plugins/code/prettify.css',
				uploadJson : 'kindeditor-4.1.7/php/upload_json.php',
				fileManagerJson : 'kindeditor-4.1.7/php/file_manager_json.php',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
	<textarea name=\"$name\" style=\"width:100%;height:300px;visibility:hidden;\">$content</textarea>
	";
	}
	public function  ueditors_2($name,$content=""){
		return "<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name=\"$name\"]', {
				cssPath : 'kindeditor-4.1.7/plugins/code/prettify.css',
				uploadJson : 'kindeditor-4.1.7/php/upload_json.php',
				fileManagerJson : 'kindeditor-4.1.7/php/file_manager_json.php',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
	<textarea name=\"$name\" style=\"width:100%;height:200px;visibility:hidden;\">$content</textarea>
	";
	}
}